package com.livestocksolutions.ui;

import android.view.View;
import android.view.ViewGroup;

import com.livestocksolutions.R;
import com.livestocksolutions.intent.BaseActivity;

/* -- Version History --
 *  1.0 : 05 August 2012 - Initial version.
 *  1.1 : 03 September 2012 - added setFocused() method and changed context from type Context to child
 *                          class BaseActivity.
 *  1.2 : 06 September 2012 - This class now extends ViewLocationPaddockArrayAdapter, all attributes that
 *                          are the same between a Location and a Paddock have been moved into that class
 */

/**
 * A base class to create the layout for a Location Object
 * @author Adam Parr
 * @version 1.2
 * 
 * @.modified 06 September 2012
 */
public class ViewLocationArrayAdapter extends ViewLocationPaddockArrayAdapter {
	/**
	 * Constructor
	 * @param context The current context.
	 * @param values The Contacts to represent in the ListView.
	 */
	public ViewLocationArrayAdapter(BaseActivity context, String[] values) {
		super(context, new String[][]{values});
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		if(textViewResourceId==0){
			setView(R.layout.item_location_view);
		}
		return super.getView(position, convertView, parent);
	}
	
	/**
	 * Display the View that will allow the modification of some fields.<br>
	 * This should be used when choosing to modify the Location.
	 */
	public void setModifyLocation(){
		setView(R.layout.item_location_modify);
	}
	
	/**
	 * Display the View that will only display the Location details.
	 */
	public void setViewLocation(){
		setView(R.layout.item_location_view);
	}
}
